package com.myapplication.ui.homefragment.shopfragment.activity_shop_detail;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;

import com.myapplication.R;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by zitaojiang on 2016/10/16.
 */
public class Activity_Shop_Detail extends AppCompatActivity {
   private WebView wv;
    @Bind(R.id.iv_detail)
    ImageView ivDetail;
    @Bind(R.id.tv_detail)
    TextView tvDetail;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shop_detail);
        ButterKnife.bind(this);
        wv= (WebView) findViewById(R.id.wv);
        initView();
    }

    private void initView() {
        Intent intent = getIntent();
        final String SpreadUrl = intent.getStringExtra("SpreadUrl");
        Log.i("ttag", "initView: "+SpreadUrl);
        String Name = intent.getStringExtra("Name");
        wv.loadUrl(SpreadUrl);
        wv.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(SpreadUrl);
                return false;
            }

        });
        WebSettings settings = wv.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

        tvDetail.setText(Name);

        ivDetail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
